#include<iostream>
using namespace std;

int n,m,s_x,s_y,d_x,d_y;
int m_x[]={1,1,2,2},m_y[]={-2,2,-1,1};
long count=0;
void dfs(int x,int y){
    if(x>d_x||y>m||y<0||x>n)return;
    if(x==d_x&&y==d_y){
        count++;
        return;
    }
    for (int i = 0; i < 4; i++) dfs(x+m_x[i],y+m_y[i]);
}

int main(int argc, char const *argv[])
{
    scanf("%d%d",&n,&m);
    scanf("%d%d%d%d",&s_x,&s_y,&d_x,&d_y);
    dfs(s_x,s_y);
    printf("%lld",count);
    return 0;
}
